package company.didi_F;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class DI1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        int min = Math.min(n, 1000);
        for (int i = 100; i < min; i++) {
            System.out.println(i);
            int a = i / 100;
            int b = (i - a * 100) / 10;
            int c = i % 10;
            System.out.println(a + " " + b + " " + c);
            if (a == b || a == c || b == c)
                continue;
            int x = Integer.parseInt(a + "" + c + "" + c);
            if (i + x == n)
                list.add(i + " " + x);
        }
        System.out.println(list.size());
        for (String s : list)
            System.out.println(s);
    }
}
